Skip to content

feat(thruster): support bottom propeller for single direction mode - #1010

Open
tibnor wants to merge 3 commits into
developfrom
claude/keen-knuth-pg3yjj
Open

feat(thruster): support bottom propeller for single direction mode#1010
tibnor wants to merge 3 commits into
developfrom
claude/keen-knuth-pg3yjj

Conversation

@tibnor

@tibnor tibnor commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixed the viewBox calculation and bottom propeller positioning in single direction thruster mode to properly accommodate both top and bottom propellers while maintaining correct visual layout.

Key Changes

  • ViewBox adjustment: When singleDirection is enabled with a bottom propeller, the viewBox is now adjusted to -80 -268 160 320 (instead of -80 -300 160 320) to provide appropriate space for the bottom propeller while keeping the doubled-height bar and top propeller visible
  • Y-coordinate adjustment: Corresponding y-coordinate updated from -320 to -288 for the adjusted viewBox
  • Bottom propeller scaling: Fixed bottom propeller height calculation to use 0.5 scale when either singleDirectionHalfSize OR singleDirection is enabled, ensuring proper positioning at the zero line where the bar base sits in single direction mode
  • Added test story: New SingleDirectionWithPropellers story to demonstrate and test single direction thruster with both top and bottom propellers

Implementation Details

The fix recognizes that in single direction mode, the bar only extends upward with its base at the zero line. Therefore, the bottom propeller must be attached at the zero line (like the half-size variant) rather than at the bottom of a missing downward bar. The viewBox adjustment ensures sufficient vertical space is allocated below the zero line to display the bottom propeller without clipping.

https://claude.ai/code/session_01Ej77SRHRBTnWQtbPBYPhzd

Summary by CodeRabbit

  • New Features
    • Added a new Storybook example showcasing thruster single-direction rendering with explicitly configured top and bottom propellers.
  • Bug Fixes
    • Improved thruster single-direction layout so the rendered area adjusts correctly depending on whether a bottom propeller is set or omitted.
    • Updated bottom propeller sizing in single-direction mode to follow the correct half-height behavior when applicable.

When `singleDirection` was enabled the bottom propeller was positioned at
the bottom of a (non-existent) downward bar and ended up outside the
viewBox, so it could not be used. Attach the bottom propeller to the zero
line (the base of the single-direction bar) like the half-size variant
does, and widen the viewBox downwards when a bottom propeller is present so
it stays in view together with the doubled-height bar and top propeller.

Add a `SingleDirectionWithPropellers` story showing a single direction
thruster with both a top and a bottom propeller.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ej77SRHRBTnWQtbPBYPhzd
@tibnor
tibnor requested review from jon-daeh and ulrik-jo as code owners June 25, 2026 08:39
@coderabbitai

coderabbitai Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: eb0c0684-e12f-47d3-84b5-ab9e6fad68ef

📥 Commits

Reviewing files that changed from the base of the PR and between c3250e8 and 3fa3aa4.

⛔ Files ignored due to path filters (1)
  • packages/openbridge-webcomponents/__vis__/linux/__baselines__/navigation-instruments/thruster/thruster.stories.ts/single-direction-with-propellers-auto.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.ts

📝 Walkthrough

Walkthrough

Adds a Storybook example for a single-direction thruster with explicit propeller types, and updates the thruster SVG layout logic to account for bottom propeller presence and half-height bottom propeller rendering.

Changes

Thruster single-direction layout

Layer / File(s) Summary
SVG layout and propeller sizing
packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.ts
The single-direction non-tunnel branch changes its viewBox and y offset based on bottomPropeller, and the bottom propeller renders at half height when singleDirection is enabled.
Storybook single-direction example
packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.stories.ts
Adds SingleDirectionWithPropellers, setting singleDirection, thrust values, state, priority, and explicit top and bottom propeller types.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • jon-daeh
  • ulrik-jo
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding bottom propeller support in single-direction thruster mode.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/keen-knuth-pg3yjj

Comment @coderabbitai help to get the list of available commands.

@tibnor tibnor changed the title Fix thruster viewBox and propeller positioning for single direction mode feat(thruster): support bottom propeller for single direction mode Jun 25, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.ts (1)

760-773: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Remove inline explanatory comments from this TypeScript block

Please replace these inline comments with self-explanatory naming (or keep explanation in docs/story), since repo rules disallow inline JS/TS comments except extremely unusual cases.

As per coding guidelines, “Do not include comments in code whatsoever unless the code is extremely unusual and impossible to understand without explanation.”

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.ts`
around lines 760 - 773, Remove the inline explanatory comments from the thruster
rendering logic in the thruster module and rely on clearer naming or external
documentation instead; specifically, delete the comments around the viewBox/y
adjustment and the single-direction thruster bar/propeller placement near the
topPropeller and bottomPropeller setup, while keeping the code behavior
unchanged.

Source: Coding guidelines

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.stories.ts`:
- Around line 105-115: The new Storybook export SingleDirectionWithPropellers is
missing the required tags field. Update the story definition in
thruster.stories.ts to include the appropriate tags array per the project
guidelines, matching the pattern used by other story exports in this file or
elsewhere (for example autodocs-related or skip-test tags as applicable).

---

Nitpick comments:
In
`@packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.ts`:
- Around line 760-773: Remove the inline explanatory comments from the thruster
rendering logic in the thruster module and rely on clearer naming or external
documentation instead; specifically, delete the comments around the viewBox/y
adjustment and the single-direction thruster bar/propeller placement near the
topPropeller and bottomPropeller setup, while keeping the code behavior
unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 261fa2ec-3795-4270-8db0-6f526fd75f9d

📥 Commits

Reviewing files that changed from the base of the PR and between e3fd128 and c82ecf8.

📒 Files selected for processing (2)
  • packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.stories.ts
  • packages/openbridge-webcomponents/src/navigation-instruments/thruster/thruster.ts

@github-actions

Copy link
Copy Markdown

@github-actions

Copy link
Copy Markdown

claude added 2 commits June 25, 2026 08:54
Add the linux visual-regression baseline for the new
`SingleDirectionWithPropellers` story (generated in the same Playwright
Docker image CI uses) so the storybook visual test passes.

Also drop the inline explanatory comments added in the previous commit to
follow the repository guideline of not using inline comments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ej77SRHRBTnWQtbPBYPhzd
The single direction viewBox was raised to make room for the bottom
propeller, but that clipped the taller bar/arrow used when there is no top
propeller (e.g. topPropeller=none with bottomPropeller=single). Keep the
top edge at -300 (which fits the tallest bar) and instead extend the
viewBox downwards so the bottom propeller fits in every top/bottom
propeller combination.

Regenerate the SingleDirectionWithPropellers visual baseline accordingly.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ej77SRHRBTnWQtbPBYPhzd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants